package com.Logistics.pdusers.controller;


import com.Logistics.mycommon.pojo.pdbase.PdGoodsType;
import com.Logistics.mycommon.pojo.pdusers.PdUser;
import com.Logistics.pdusers.feign.PdgoodTypeFeign;
import com.Logistics.pdusers.service.PdUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fuqinggui
 * @since 2024-08-06
 */
@CrossOrigin
@RestController
@RequestMapping("/serviceusers/pd-user")
public class PdUserController {

    @Autowired
    private PdUserService pdUserService;

    @Autowired
    private PdgoodTypeFeign pdgoodTypeFeign;

    //登录
    @PostMapping
    public PdUser Login(@RequestBody HashMap<String,String> map){
        return pdUserService.Login(map);
    }

    //注册用户
    @PostMapping("/add")
    public HashMap<String,String> addUserInfo(@RequestBody HashMap<String,String> map){
        return pdUserService.saveUserInfo(map);
    }

    //验证码登录
    @PostMapping("/MsgLogin")
    public HashMap<String,Object> selectByMsg(@RequestBody HashMap<String,String> map){
        return pdUserService.selectByMsg(map);
    }

    //查询货物信息
    @PostMapping("/{name}")
    public List<PdGoodsType> goodsTypes(@PathVariable String name){
        return pdgoodTypeFeign.goodsTypes(name);
    }

}

